package com.laiyizhan.common.mapper;

import com.laiyizhan.common.model.Sixth_e;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Sixth_eMapper {

    @Select({
            "select",
            "*",
            "from Sixth_e",
            "where hospital = #{oName,jdbcType=VARCHAR}"
    })
    @ResultMap("BaseResultMap")
    List<Sixth_e> selectByName(String oName);
    @Delete({
            "delete from Sixth_e",
            "where hospital = #{oName,jdbcType=VARCHAR}"
    })
    int deleteByName(String oName);

    int insertBatch(List<Sixth_e> item);
    @Delete({
        "delete from sixth_e",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into sixth_e (hospital, name, ",
        "type, count, price)",
        "values (#{hospital,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ",
        "#{type,jdbcType=VARCHAR}, #{count,jdbcType=VARCHAR}, #{price,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(Sixth_e record);

    int insertSelective(Sixth_e record);

    @Select({
        "select",
        "id, hospital, name, type, count, price",
        "from sixth_e",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    Sixth_e selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Sixth_e record);

    @Update({
        "update sixth_e",
        "set hospital = #{hospital,jdbcType=VARCHAR},",
          "name = #{name,jdbcType=VARCHAR},",
          "type = #{type,jdbcType=VARCHAR},",
          "count = #{count,jdbcType=VARCHAR},",
          "price = #{price,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Sixth_e record);
}